<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>7_2_2-3-监听a修改b</title>
</head>

<body>


    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>


    <div id="Application">
        <button @click="click">单击改变a的值</button>
    </div>
    <script>
        const App = Vue.createApp({
            setup() {
                let a = Vue.ref(1);
                let b = Vue.ref(10)
                const click = () => {
                    a.value += 1;
                }
                Vue.watchEffect(() => {
                    //当a变化时，修改b的值
                    a;
                    b.value += 1;
                    console.log(a.value, b.value);
                })

                return {
                    a,
                    click
                }
            }
        })
        App.mount("#Application")
    </script>
</body>

</html>